const path = require("node:path")
const webpackPath = require("./webpack.path.js")


module.exports = {
  mode: 'development',
  devtool: 'inline-source-map',
  target: 'electron-main',
  entry: {
    main: path.join(webpackPath.srcMainPath, "main.ts"),
    preload: path.join(webpackPath.srcPreloadPath, "preload.ts")
  },
  output: {
    filename: '[name].js',
    path: webpackPath.distPath,
  },
  module: {
    rules: [
      {
        test: /\.[jt]sx?$/,
        exclude: /node_modules/,
        use: {
          loader: 'ts-loader',
          options: {
            // Remove this line to enable type checking in webpack builds
            transpileOnly: true,
            compilerOptions: {
              module: 'esnext',
            },
          },
        },
      },
    ],
  },
  resolve: {
    extensions: ['.js', '.tsx', '.ts', '.jsx'],
    alias: {
      '@': path.resolve(__dirname, '..', 'src')
    }
  }
}